-
Notifications
You must be signed in to change notification settings - Fork 12.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix: mock ConstParm when encounter LateBound during convert path expr #108206
Conversation
(rustbot has picked a reviewer for you, use r? to override) |
Can you explain why this fixes the issue? I don't know if this is the right approach for this ICE. |
The current method is problematic and I am trying new ideas. |
I'll mark this as waiting on author then. @rustbot author |
16bdc04
to
6495c63
Compare
where for
please review it when you have time @compiler-errors |
bug!("unexpected bound var resolution for {:?}: {arg:?}", expr.hir_id) | ||
} | ||
} | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This code should be this one
rust/compiler/rustc_hir_analysis/src/astconv/mod.rs
Lines 2675 to 2693 in a9842c7
match tcx.named_bound_var(hir_id) { | |
Some(rbv::ResolvedArg::LateBound(debruijn, index, _)) => { | |
let name = | |
tcx.hir().name(tcx.hir().local_def_id_to_hir_id(def_id.expect_local())); | |
let br = ty::BoundTy { | |
var: ty::BoundVar::from_u32(index), | |
kind: ty::BoundTyKind::Param(def_id, name), | |
}; | |
tcx.mk_ty(ty::Bound(debruijn, br)) | |
} | |
Some(rbv::ResolvedArg::EarlyBound(_)) => { | |
let def_id = def_id.expect_local(); | |
let item_def_id = tcx.hir().ty_param_owner(def_id); | |
let generics = tcx.generics_of(item_def_id); | |
let index = generics.param_def_id_to_index[&def_id.to_def_id()]; | |
tcx.mk_ty_param(index, tcx.hir().ty_param_name(def_id)) | |
} | |
arg => bug!("unexpected bound var resolution for {hir_id:?}: {arg:?}"), | |
} |
but with Const
instead of Ty
where relevant.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Constructing a ParamConst
like the code is currently doing is incorrect, and I think would be problematic because we'll be treating it like an early-bound const param.
There currently isn't a THIR representation for a bound const that's been "liberated" like a placeholder (or a free region). I'm not really sure what that would look like, either. This probably needs a more involved solution than what's curently implemented.
6495c63
to
22f4156
Compare
The job Click to see the possible cause of the failure (guessed by this bot)
|
close #108194